package com.zrwl.poscloud.xo.vo;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zrwl.poscloud.commons.utils.DateUtils;
import com.zrwl.poscloud.commons.vo.BaseVO;
import com.zrwl.poscloud.commons.vo.browserTool.CardInfo718VO;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

;
;

/**
 * 卡片变动记录 VO类
 *
 * @author 刘思童 AutoGenerate
 * @date 2021-07-26
 */
@Data
public class ICCardLogVO extends BaseVO<ICCardLogVO> {
    private static final long serialVersionUID = 1L;
    private int sourceType;
    private String sourceUid;
    private String batchUid;
    private Date sourceTime;
    private String cardUid;
    private String summary;
    private String cardSerialNumber;
    private int useCount;
    private String cardCode;
    private int payLevel;
    private int cardType;
    private int type;
    private String companyUid;
    double dayMax;
    double monthMax;
    String pwd;
    double balanceAmt;
    double subsidyBalanceAmt;
    double secondAmt;
    int balanceCount;
    double giftAmt;
    double feeAmt;
    private Date validDate;
    private Date subsidyValidDate;

    private int serverFlowCode;
    private int payFlowCode;
    private int rechargeFlowCode;
    private int netFlowCode;
    private int syncFlowCode;

    private String gateCode;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date tradeTime;
    private String presentFlowCode;
    private String jsonStr;
    private String employeeUid;

    private String accountRecordAmt;
    private String cardRecordAmt;

    double balanceAmtTotal;//计算过的累计金额
    double subsidyBalanceAmtTotal;//计算过的补贴累计金额
    int balanceCountTotal;//计算过的累计钱包次数

    private String employeeName;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date nowRequestTime;

    private String deptName;
    private int businessType;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    private String employeeCode;

    String cardDataJsonStr;

    public ICCardLogVO() {
    }

    public ICCardLogVO(CardInfo718VO cardInfo718VO) {

        employeeName = cardInfo718VO.getName();
        employeeCode = cardInfo718VO.getUserid();
        deptName = cardInfo718VO.getDeptname();
        useCount = Integer.parseInt(cardInfo718VO.getSecuritycode());

        payLevel = Integer.parseInt(cardInfo718VO.getGrade());
        cardType = Integer.parseInt(cardInfo718VO.getCardtype());
        pwd = cardInfo718VO.getPassword();
        validDate = DateUtils.getDate(cardInfo718VO.getValiddate() + " 00:00:00", 0);
        subsidyValidDate = DateUtils.getDate(
                cardInfo718VO.getSub1date() + " 00:00:00",
                Integer.parseInt(cardInfo718VO.getSub1days()));
        dayMax = Double.parseDouble(cardInfo718VO.getMealmoney());
        balanceAmt = Double.parseDouble(cardInfo718VO.getLastmoney());
        subsidyBalanceAmt = Double.parseDouble(cardInfo718VO.getSubsidy1money());


        payFlowCode = Integer.parseInt(cardInfo718VO.getPosnumber());

        rechargeFlowCode = Integer.parseInt(cardInfo718VO.getSubsidynumber());
        netFlowCode = Integer.parseInt(cardInfo718VO.getDeductnumber());

//        netFlowCode = net1 > net2 ? net1 : net2;
        cardSerialNumber = cardInfo718VO.getCardNo();

        cardDataJsonStr = JSONObject.toJSONString(cardInfo718VO);
    }
}
